﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的材料详情 - 模切材料小管家</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            /* TDesign 工业品色彩系统 */
            --primary-color: #0052d9;
            --primary-light: #266fe8;
            --primary-dark: #003cab;
            --secondary-color: #f2f3ff;
            --accent-color: #e37318;
            --success-color: #00a870;
            --warning-color: #ed7b2f;
            --error-color: #d54941;
            
            /* 背景色系 */
            --bg-color-page: #f5f7fa;
            --bg-color-container: #ffffff;
            --bg-color-secondray: #f8f9fc;
            
            /* 边框和分割线 */
            --border-color: #e7e7e7;
            --border-color-light: #f0f0f0;
            --border-radius-small: 3px;
            --border-radius-medium: 6px;
            --border-radius-large: 9px;
            
            /* 文字色彩 */
            --text-primary: #1a1a1a;
            --text-secondary: #4e5969;
            --text-placeholder: #86909c;
            --text-disabled: #c9cdd4;
            
            /* 阴影系统 */
            --shadow-1: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
            --shadow-2: 0 1px 4px 0 rgba(0, 0, 0, 0.08);
            --shadow-3: 0 4px 8px 0 rgba(0, 0, 0, 0.12);
            
            /* 间距系统 */
            --space-1: 4px;
            --space-2: 8px;
            --space-3: 12px;
            --space-4: 16px;
            --space-5: 20px;
            --space-6: 24px;
            --space-8: 32px;
            --space-10: 40px;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        }
        
        body {
            background-color: var(--bg-color-page);
            color: var(--text-primary);
            font-size: 14px;
            line-height: 1.5;
            padding-bottom: 120px;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }
        
        .container {
            max-width: 480px;
            margin: 0 auto;
            background: var(--bg-color-container);
            min-height: 100vh;
            box-shadow: var(--shadow-1);
            position: relative;
            overflow-x: hidden;
        }
        
        /* 头部样式 - TDesign 简约风格 */
        .header {
            background: var(--primary-color);
            color: white;
            padding: var(--space-4) var(--space-4) var(--space-5);
            position: relative;
            z-index: 10;
        }
        
        .top-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: var(--space-4);
        }
        
        .back-btn {
            font-size: 18px;
            cursor: pointer;
            opacity: 0.9;
            transition: opacity 0.2s ease;
        }
        
        .back-btn:hover {
            opacity: 1;
        }
        
        .page-title {
            font-weight: 500;
            font-size: 16px;
        }
        
        .actions {
            display: flex;
            gap: var(--space-5);
        }
        
        .actions i {
            font-size: 16px;
            cursor: pointer;
            opacity: 0.9;
            transition: opacity 0.2s ease;
        }
        
        .actions i:hover {
            opacity: 1;
        }
        
        /* 参考group-detail.html的布局样式 */
        .group-info {
            padding: var(--space-4);
        }
        
        .info-section {
            background: var(--bg-color-container);
            border-radius: var(--border-radius-medium);
            margin-bottom: var(--space-4);
            box-shadow: var(--shadow-1);
            overflow: hidden;
            border: 1px solid var(--border-color-light);
        }
        
        .section-header {
            padding: var(--space-4);
            border-bottom: 1px solid var(--border-color-light);
            background: var(--bg-color-secondray);
        }
        
        .section-title {
            font-size: 14px;
            font-weight: 500;
            color: var(--text-primary);
            display: flex;
            align-items: center;
        }
        
        .section-title i {
            margin-right: var(--space-2);
            color: var(--primary-color);
            font-size: 14px;
        }
        
        .section-content {
            padding: var(--space-4);
        }
        
        .info-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: var(--space-4);
            margin-bottom: var(--space-4);
        }
        
        .info-item {
            display: flex;
            flex-direction: column;
        }
        
        .info-label {
            color: var(--text-placeholder);
            font-size: 12px;
            margin-bottom: var(--space-1);
        }
        
        .info-value {
            color: var(--text-primary);
            font-size: 14px;
            font-weight: 500;
        }
        
        /* 查看技术参数按钮 - TDesign 简约风格 */
        .tech-params-btn {
            background: var(--primary-color);
            color: white;
            border: none;
            border-radius: var(--border-radius-medium);
            padding: var(--space-2) var(--space-5);
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
            margin-top: var(--space-2);
        }
        
        .tech-params-btn:hover {
            background: var(--primary-light);
        }
        
        /* 企业信息样式 */
        .company-info {
            display: flex;
            align-items: center;
            padding: var(--space-4);
        }
        
        .company-logo {
            width: 40px;
            height: 40px;
            border-radius: var(--border-radius-medium);
            background: var(--primary-color);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 16px;
            margin-right: var(--space-3);
            flex-shrink: 0;
        }
        
        .company-details {
            flex: 1;
        }
        
        .company-name {
            font-size: 14px;
            font-weight: 500;
            color: var(--text-primary);
            margin-bottom: var(--space-1);
        }
        
        .company-location {
            font-size: 12px;
            color: var(--text-secondary);
            margin-bottom: var(--space-2);
        }
        
        .company-rating {
            display: flex;
            align-items: center;
            gap: var(--space-2);
        }
        
        .rating-stars {
            display: flex;
            gap: 2px;
        }
        
        .rating-stars i {
            color: #ffc107;
            font-size: 10px;
        }
        
        .rating-text {
            font-size: 10px;
            color: var(--text-placeholder);
        }
        
        .contact-info {
            display: flex;
            flex-direction: column;
            gap: var(--space-1);
            margin-top: var(--space-3);
            padding-top: var(--space-3);
            border-top: 1px solid var(--border-color-light);
        }
        
        .contact-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 12px;
        }
        
        .contact-label {
            color: var(--text-secondary);
        }
        
        .contact-value {
            color: var(--text-primary);
            font-weight: 500;
        }

        /* 底部操作栏 */
        .bottom-actions {
            position: fixed;
            bottom: 64px;
            left: 0;
            right: 0;
            background: var(--bg-color-container);
            padding: var(--space-4);
            border-top: 1px solid var(--border-color-light);
            display: flex;
            gap: var(--space-2);
            z-index: 100;
            max-width: 480px;
            margin: 0 auto;
        }
        
        .btn {
            flex: 1;
            padding: var(--space-3);
            border: none;
            border-radius: var(--border-radius-medium);
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: var(--space-2);
        }
        
        .btn-secondary {
            background: var(--bg-color-secondray);
            color: var(--text-secondary);
            border: 1px solid var(--border-color-light);
        }
        
        .btn-secondary:hover {
            background: var(--border-color-light);
        }
        
        .btn-primary {
            background: var(--primary-color);
            color: white;
        }
        
        .btn-primary:hover {
            background: var(--primary-dark);
        }
        
        .btn-danger {
            background: var(--error-color);
            color: white;
        }
        
        .btn-danger:hover {
            background: #c0392b;
        }
        
        /* 询价区域样式 - 保持原有样式不变 */
        .inquiry-section {
            background: var(--bg-color-container);
            border-radius: var(--border-radius-medium);
            margin: var(--space-4) 0;
            box-shadow: var(--shadow-1);
            overflow: hidden;
            border: 1px solid var(--border-color-light);
        }
        
        .inquiry-badge {
            background: var(--accent-color);
            color: white;
            font-size: 10px;
            padding: var(--space-1) var(--space-2);
            border-radius: var(--border-radius-small);
            margin-left: var(--space-2);
        }
        
        /* 询价列表样式 */
        .inquiry-list {
            /* 移除固定高度和滚动条，让内容自然流动 */
        }
        
        .inquiry-item {
            display: flex;
            align-items: center;
            padding: var(--space-2) 0;
            border-bottom: 1px solid var(--border-color-light);
        }
        
        .inquiry-item:last-child {
            border-bottom: none;
        }
        
        .inquiry-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: var(--primary-color);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: 500;
            font-size: 12px;
            margin-right: var(--space-2);
            flex-shrink: 0;
        }
        
        .inquiry-info {
            flex: 1;
            min-width: 0;
        }
        
        .inquiry-name {
            font-size: 12px;
            font-weight: 500;
            color: var(--text-primary);
            margin-bottom: var(--space-1);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        .inquiry-details {
            font-size: 11px;
            color: var(--text-placeholder);
            line-height: 1.3;
        }
        
        
        .inquiry-time {
            font-size: 10px;
            color: var(--text-placeholder);
            text-align: right;
            min-width: 80px;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: var(--space-1);
        }
        
        /* 新询价标签 */
        .new-inquiry-badge {
            background: var(--error-color);
            color: white;
            font-size: 9px;
            padding: 1px 4px;
            border-radius: var(--border-radius-small);
            margin-left: var(--space-1);
            font-weight: 500;
        }
        
        /* 标记按钮 */
        .mark-button {
            background: var(--primary-color);
            color: white;
            border: none;
            border-radius: var(--border-radius-small);
            padding: var(--space-1) var(--space-2);
            font-size: 10px;
            cursor: pointer;
            margin-left: var(--space-2);
            transition: background-color 0.2s ease;
        }
        
        .mark-button:hover {
            background: var(--primary-dark);
        }
        
        /* 查看留言按钮 */
        .view-message-btn {
            background: var(--success-color);
            color: white;
            border: none;
            border-radius: var(--border-radius-small);
            padding: var(--space-1) var(--space-2);
            font-size: 10px;
            cursor: pointer;
            margin-left: var(--space-1);
            transition: background-color 0.2s ease;
        }
        
        .view-message-btn:hover {
            background: #00a870;
        }

        /* 弹框样式 */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
        }
        
        .modal-overlay.show {
            opacity: 1;
            visibility: visible;
        }
        
        .modal {
            background: var(--bg-color-container);
            border-radius: var(--border-radius-large);
            padding: var(--space-6);
            margin: var(--space-4);
            max-width: 400px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
            box-shadow: var(--shadow-3);
            transform: scale(0.9);
            transition: transform 0.3s ease;
        }
        
        .modal-overlay.show .modal {
            transform: scale(1);
        }
        
        .modal-header {
            text-align: center;
            margin-bottom: var(--space-5);
            border-bottom: 1px solid var(--border-color-light);
            padding-bottom: var(--space-3);
        }
        
        .modal-title {
            font-size: 16px;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: var(--space-2);
        }
        
        .modal-subtitle {
            font-size: 12px;
            color: var(--text-secondary);
        }
        
        .modal-content {
            margin-bottom: var(--space-5);
        }
        
        .user-info {
            display: flex;
            align-items: center;
            margin-bottom: var(--space-4);
            padding: var(--space-3);
            background: var(--bg-color-secondray);
            border-radius: var(--border-radius-medium);
        }
        
        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: var(--primary-color);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: 500;
            font-size: 16px;
            margin-right: var(--space-3);
            flex-shrink: 0;
        }
        
        .user-details {
            flex: 1;
        }
        
        .user-name {
            font-size: 14px;
            font-weight: 500;
            color: var(--text-primary);
            margin-bottom: var(--space-1);
        }
        
        .user-phone {
            font-size: 12px;
            color: var(--text-secondary);
        }
        
        .message-content {
            background: var(--bg-color-container);
            border: 1px solid var(--border-color-light);
            border-radius: var(--border-radius-medium);
            padding: var(--space-4);
            margin-bottom: var(--space-3);
        }
        
        .message-label {
            font-size: 12px;
            color: var(--text-placeholder);
            margin-bottom: var(--space-2);
        }
        
        .message-text {
            font-size: 14px;
            color: var(--text-primary);
            line-height: 1.6;
        }
        
        .message-time {
            font-size: 12px;
            color: var(--text-placeholder);
            text-align: right;
        }
        
        .modal-actions {
            display: flex;
            justify-content: center;
            gap: var(--space-3);
        }
        
        .modal-btn {
            min-width: 100px;
            padding: var(--space-3) var(--space-5);
            border: none;
            border-radius: var(--border-radius-medium);
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .modal-btn-secondary {
            background: var(--bg-color-secondray);
            color: var(--text-secondary);
            border: 1px solid var(--border-color-light);
        }
        
        .modal-btn-secondary:hover {
            background: var(--border-color-light);
        }
        
        .modal-btn-primary {
            background: var(--primary-color);
            color: white;
        }
        
        .modal-btn-primary:hover {
            background: var(--primary-dark);
        }
        
        /* 底部导航栏 - TDesign 简约风格 */
        .tabbar {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background: var(--bg-color-container);
            border-top: 1px solid var(--border-color);
            display: flex;
            z-index: 100;
            max-width: 480px;
            margin: 0 auto;
            height: 64px;
        }
        
        .tab-item {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: var(--space-2) 0;
            cursor: pointer;
            transition: color 0.2s ease;
            color: var(--text-placeholder);
        }
        
        .tab-item.active {
            color: var(--primary-color);
        }
        
        .tab-item:hover {
            color: var(--primary-light);
        }
        
        .tab-item i {
            font-size: 18px;
            margin-bottom: var(--space-1);
        }
        
        .tab-item span {
            font-size: 10px;
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- 头部区域 -->
        <div class="header">
            <div class="top-bar">
                <div class="back-btn" onclick="history.back()">
                    <i class="fas fa-arrow-left"></i>
                </div>
                <div class="page-title">我的材料详情</div>
                <div class="actions">
                </div>
            </div>
        </div>
        
        <!-- 材料信息 -->
        <div class="group-info">
            
            <!-- 内容信息 -->
            <div class="info-section">
                <div class="section-header">
                <div class="section-title">
                    <i class="fas fa-info-circle"></i>
                        <span>内容信息</span>
                </div>
                </div>
                <div class="section-content">
                    <div class="info-grid">
                        <div class="info-item">
                            <div class="info-label">产品类别:</div>
                            <div class="info-value" id="productType">胶带类</div>
                </div>
                        <div class="info-item">
                            <div class="info-label">产品名称:</div>
                            <div class="info-value" id="productTypeName">BOPP单面胶带</div>
                </div>
                        <div class="info-item">
                            <div class="info-label">产品型号:</div>
                            <div class="info-value" id="productModel">BOPP-002</div>
                </div>
                        <div class="info-item">
                            <div class="info-label">产品规格:</div>
                            <div class="info-value" id="productSpecDetails">36mm × 100m/卷</div>
                </div>
                        <div class="info-item">
                            <div class="info-label">所在地:</div>
                            <div class="info-value" id="productLocationDetail">江苏省苏州市</div>
                </div>
                        <div class="info-item">
                            <div class="info-label">发布时间:</div>
                            <div class="info-value" id="publishTimeDetail">2024年1月15日</div>
                </div>
            </div>
            
                    <div class="info-item" style="grid-column: 1 / -1;">
                        <div class="info-label">产品描述:</div>
                        <div class="info-value" id="productDescription">本产品采用优质BOPP薄膜为基材，涂布高性能丙烯酸压敏胶，具有优异的粘接性能和耐候性。适用于包装、封箱、办公等场合，粘着力强，使用方便，是理想的包装材料。</div>
                </div>
                    
                    <button class="tech-params-btn" onclick="viewTechParams()">
                        <i class="fas fa-file-alt"></i> 查看技术参数
                    </button>
                </div>
            </div>
            
            <!-- 企业信息 -->
            <div class="info-section">
                <div class="section-header">
                <div class="section-title">
                    <i class="fas fa-building"></i>
                        <span>企业信息</span>
                </div>
                </div>
                <div class="section-content">
                <div class="company-info">
                    <div class="company-logo">
                        <i class="fas fa-industry"></i>
                    </div>
                    <div class="company-details">
                            <div class="company-name" id="companyName">鑫源材料厂</div>
                            <div class="company-location" id="companyLocation">江苏 · 苏州</div>
                        <div class="company-rating">
                            <div class="rating-stars">
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                            </div>
                                <span class="rating-text">4.8分</span>
                        </div>
                    </div>
                </div>
                    
                <div class="contact-info">
                        <div class="contact-item">
                            <div class="contact-label">联系人:</div>
                            <div class="contact-value" id="contactName">张经理</div>
                    </div>
                        <div class="contact-item">
                            <div class="contact-label">联系电话:</div>
                            <div class="contact-value" id="contactPhone">138****8000</div>
                    </div>
                        <div class="contact-item">
                            <div class="contact-label">邮箱:</div>
                            <div class="contact-value" id="contactEmail">zhang@xinyuan.com</div>
                </div>
                        <div class="contact-item">
                            <div class="contact-label">所在地:</div>
                            <div class="contact-value" id="contactAddress">江苏省苏州市工业园区科技路123号</div>
                    </div>
                    </div>
                </div>
            </div>
            
        </div>
        
        <!-- 询价区域 - 保持原有结构不变 -->
            <div class="inquiry-section">
                <div class="section-header">
                    <div class="section-title">
                        <i class="fas fa-calculator"></i>
                        <span>询价</span>
                        <span class="inquiry-badge" id="inquiryCount">3</span>
                    </div>
                </div>
                <div class="section-content">
                    <div class="inquiry-list" id="inquiryList">
                        <!-- 询价列表将通过JavaScript动态生成 -->
                    </div>
                </div>
            </div>
        
        <!-- 底部操作栏 -->
        <div class="bottom-actions">
            <button class="btn btn-secondary" onclick="editMaterial()">
                <i class="fas fa-edit"></i> 编辑材料
            </button>
            <button class="btn btn-danger" onclick="closeMaterial()">
                <i class="fas fa-times"></i> 关闭材料
            </button>
        </div>
        
        <!-- 留言详情弹框 -->
        <div class="modal-overlay" id="messageModal">
            <div class="modal">
                <div class="modal-header">
                    <div class="modal-title">留言详情</div>
                    <div class="modal-subtitle">查看用户提交的询价留言</div>
                        </div>
                        
                <div class="modal-content">
                    <div class="user-info">
                        <div class="user-avatar" id="modalUserAvatar">张</div>
                        <div class="user-details">
                            <div class="user-name" id="modalUserName">广本中材有限公司 张经理</div>
                            <div class="user-phone" id="modalUserPhone">13812345678</div>
                            </div>
                        </div>
                        
                    <div class="message-content">
                        <div class="message-label">留言内容：</div>
                        <div class="message-text" id="modalMessageText">
                            您好，我需要36mm的BOPP胶带，质量要求较高，请问贵公司的产品是否符合要求？可以提供技术参数吗？
                            </div>
                            </div>
                    
                    <div class="message-time" id="modalMessageTime">2024-01-18 10:00</div>
                        </div>
                
                <div class="modal-actions">
                    <button class="modal-btn modal-btn-primary" onclick="closeModal()">关闭</button>
                    </div>
                </div>
        </div>
        
        <!-- 底部导航 -->
        <div class="tabbar">
            <div class="tab-item" onclick="location.href='home.html'">
                <i class="fas fa-home"></i>
                <span>首页</span>
            </div>
            <div class="tab-item" onclick="location.href='demand-list.html'">
                <i class="fas fa-search"></i>
                <span>求购</span>
            </div>
            <div class="tab-item" onclick="location.href='publish-select.html'">
                <i class="fas fa-plus-circle"></i>
                <span>发布</span>
            </div>
            <div class="tab-item" onclick="location.href='consultation.html'">
                <i class="fas fa-comments"></i>
                <span>客服</span>
            </div>
            <div class="tab-item" onclick="location.href='profile.html'">
                <i class="fas fa-user"></i>
                <span>我的</span>
            </div>
        </div>
    </div>
    
    <script>
        // 模拟材料数据
        const materialData = {
            productType: '胶带类',
            productTypeName: 'BOPP单面胶带',
            productModel: 'BOPP-002',
            productSpecDetails: '36mm × 100m/卷',
            productLocationDetail: '江苏省苏州市',
            publishTimeDetail: '2024年1月15日',
            productDescription: '本产品采用优质BOPP薄膜为基材，涂布高性能丙烯酸压敏胶，具有优异的粘接性能和耐候性。适用于包装、封箱、办公等场合，粘着力强，使用方便，是理想的包装材料。',
            companyName: '鑫源材料厂',
            companyLocation: '江苏 · 苏州',
            contactName: '张经理',
            contactPhone: '138****8000',
            contactEmail: 'zhang@xinyuan.com',
            contactAddress: '江苏省苏州市工业园区科技路123号'
        };

        // 模拟询价留言数据
        const inquiryMessages = [
            {
                id: 0,
                userName: '广本中材有限公司 张***',
                userNameFull: '广本中材有限公司 张经理',
                userPhone: '138****8000',
                userPhoneFull: '13812345678',
                userAvatar: '张',
                message: '您好，我需要36mm的BOPP胶带，质量要求较高，请问贵公司的产品是否符合要求？可以提供技术参数吗？期待您的回复。',
                time: '2024-01-18 10:00',
                hasMessage: true
            },
            {
                id: 1,
                userName: '苏州胶带制造有限公司 李***',
                userNameFull: '苏州胶带制造有限公司 李总',
                userPhone: '139****9999',
                userPhoneFull: '13923456789',
                userAvatar: '李',
                message: '需要采购大量BOPP胶带，请报价。我们是做包装行业的，月用量比较大，希望能建立长期合作关系。',
                time: '2024-01-17 14:30',
                hasMessage: true
            },
            {
                id: 2,
                userName: '东莞材料科技有限公司 王***',
                userNameFull: '东莞材料科技有限公司 王主管',
                userPhone: '137****7777',
                userPhoneFull: '13734567890',
                userAvatar: '王',
                message: '',
                time: '2024-01-16 09:15',
                hasMessage: false
            }
        ];
        
        // 加载材料数据
        function loadMaterialData() {
            // 更新页面内容
            document.getElementById('productType').textContent = materialData.productType;
            document.getElementById('productTypeName').textContent = materialData.productTypeName;
            document.getElementById('productModel').textContent = materialData.productModel;
            document.getElementById('productSpecDetails').textContent = materialData.productSpecDetails;
            document.getElementById('productLocationDetail').textContent = materialData.productLocationDetail;
            document.getElementById('publishTimeDetail').textContent = materialData.publishTimeDetail;
            document.getElementById('productDescription').textContent = materialData.productDescription;
            
            // 更新企业信息
            document.getElementById('companyName').textContent = materialData.companyName;
            document.getElementById('companyLocation').textContent = materialData.companyLocation;
            document.getElementById('contactName').textContent = materialData.contactName;
            document.getElementById('contactPhone').textContent = materialData.contactPhone;
            document.getElementById('contactEmail').textContent = materialData.contactEmail;
            document.getElementById('contactAddress').textContent = materialData.contactAddress;
        }
        
        // 查看技术参数
        function viewTechParams() {
            alert('查看技术参数功能开发中...');
        }

        // 编辑材料
        function editMaterial() {
            // 可以跳转到编辑页面或弹出编辑弹框
            if (confirm('确定要编辑这个材料信息吗？')) {
                alert('跳转到编辑页面...');
                // 实际项目中可以跳转到编辑页面
                // window.location.href = 'edit-material.html?id=' + materialId;
            }
        }

        // 关闭材料
        function closeMaterial() {
            if (confirm('确定要关闭这个材料吗？关闭后将不再对外展示。')) {
                alert('材料已关闭');
                // 实际项目中可以调用API关闭材料
                // 然后跳转回材料列表页面
                // window.location.href = 'my-materials.html';
            }
        }
        
        // 标记为已读
        function markAsRead(button) {
            button.textContent = '已读';
            button.style.background = 'var(--text-placeholder)';
            button.disabled = true;
        }

        // 查看留言
        function viewMessage(messageId) {
            const messageData = inquiryMessages.find(msg => msg.id === messageId);
            
            if (messageData && messageData.hasMessage) {
                // 更新弹框内容，使用完整的用户信息
                document.getElementById('modalUserAvatar').textContent = messageData.userAvatar;
                document.getElementById('modalUserName').textContent = messageData.userNameFull;
                document.getElementById('modalUserPhone').textContent = messageData.userPhoneFull;
                document.getElementById('modalMessageText').textContent = messageData.message;
                document.getElementById('modalMessageTime').textContent = messageData.time;
                
                // 显示弹框
                const modal = document.getElementById('messageModal');
                modal.classList.add('show');
            }
        }

        // 关闭弹框
        function closeModal() {
            const modal = document.getElementById('messageModal');
            modal.classList.remove('show');
        }


        // 点击弹框背景关闭
        document.getElementById('messageModal').addEventListener('click', function(e) {
            if (e.target === this) {
                closeModal();
            }
        });
        
        // 加载询价列表
        function loadInquiryList() {
            const inquiryList = document.getElementById('inquiryList');
            inquiryList.innerHTML = '';
            
            inquiryMessages.forEach((inquiry, index) => {
                const inquiryItem = document.createElement('div');
                inquiryItem.className = 'inquiry-item';
                
                const viewMessageButton = inquiry.hasMessage ? 
                    `<button class="view-message-btn" onclick="viewMessage(${inquiry.id})">查看留言</button>` : '';
                
                const newBadge = index === 0 ? '<span class="new-inquiry-badge">新</span>' : '';
                
                inquiryItem.innerHTML = `
                    <div class="inquiry-avatar">${inquiry.userAvatar}</div>
                    <div class="inquiry-info">
                        <div class="inquiry-name">
                            ${inquiry.userName}
                            ${newBadge}
                        </div>
                        <div class="inquiry-details">${inquiry.userPhone}</div>
                    </div>
                    <div class="inquiry-time">
                        <div style="margin-bottom: var(--space-1);">${inquiry.time}</div>
                        <div style="display: flex; gap: var(--space-1);">
                            ${viewMessageButton}
                            <button class="mark-button" onclick="markAsRead(this)">标记已读</button>
                        </div>
                    </div>
                `;
                
                inquiryList.appendChild(inquiryItem);
            });
        }

        // 页面加载完成后初始化
        document.addEventListener('DOMContentLoaded', function() {
            loadMaterialData();
            loadInquiryList();
        });
        
        // 底部导航切换
        document.querySelectorAll('.tab-item').forEach(item => {
            item.addEventListener('click', function() {
                document.querySelectorAll('.tab-item').forEach(t => t.classList.remove('active'));
                this.classList.add('active');
            });
        });
    </script>
</body>
</html>